<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>

<title>jQuery Autocomplete Plugin</title>
<script type="text/javascript" src="jquery-1.6.min.js"></script>
<script type='text/javascript' src='jquery.autocomplete.js'></script>
<link rel="stylesheet" type="text/css" href="../css/jquery.autocomplete.css" />
	
<script type="text/javascript">

var namesdata = [{name:"whs",id:"1"},{name:"wanghaishen",id:"2"}];


$().ready(function() {

	
	$("#suggest1").focus().autocomplete(namesdata,{
		dataType:'json',
		minChars: 0,
		max: 5,
		autoFill: true,
		mustMatch: true,
		matchContains: true,
		scrollHeight: 220,
		formatItem: function(data, i, total) {
			return data.name;
		},
		formatResult: function(data) {
			return data.id;
		}
});

	
});

function ddd(){
	
	alert($("#suggest1").val());
}

</script>
	
</head>

<body>


<div id="content">
	
	<form autocomplete="off">
		<p>
			<label>Single City (local):</label>
			<input type="text" id="suggest1" />
			
			<input type="button" onclick="ddd()" value="ddd"/>
		</p>
	</form>
	

</div>

</body>
</html>
